package com.sjgl.esdn.service;

import com.sjgl.esdn.domain.entity.Boxroom;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * 收藏夹服务
 *
 * @author 缪恒铭
 * @date 2022/08/11
 */
public interface BoxroomService {
    /**
     * 插入收藏夹
     *
     * @param userId      用户id
     * @param boxroomName 收藏夹名字
     * @return int
     */
    public int insertBoxroom(@Param("userId") Long userId, @Param("boxroomName") String boxroomName, @Param("intro") String intro);

    /**
     * 删除收藏夹(真删)
     *
     * @param boxroomId 收藏夹id
     * @return int
     */
    public int deleteBoxroom(@Param("boxroomId") Long boxroomId);

    /**
     * 更新收藏夹
     *
     * @param boxroomId   收藏夹id
     * @param boxroomName 收藏夹名字
     * @param intro       介绍
     * @param userId      用户id
     * @return int
     */
    public int updateBoxroom(@Param("boxroomId") Long boxroomId, @Param("boxroomName") String boxroomName, @Param("intro") String intro, @Param("userId") Long userId);

    /**
     * 选择收藏夹通过id
     *
     * @param boxroomId 收藏夹id
     * @return {@link Boxroom}
     */
    public Boxroom selectBoxroomById(@Param("boxroomId") Long boxroomId);

    /**
     * 选择文件id列表通过id
     *
     * @param boxroomId 收藏夹id
     * @return {@link List}<{@link Long}>
     */
    public List<Long> selectFileIdListById(@Param("boxroomId") Long boxroomId);

    /**
     * 查询收藏夹id列表通过用户id
     *
     * @param userId 用户id
     * @return {@link List}<{@link Long}>
     */
    public List<Long> selectBoxroomIdListByUserId(@Param("userId") Long userId);

    /**
     * 查询收藏夹列表通过收藏夹id列表
     *
     * @param boxroomIdList 收藏夹id列表
     * @return {@link List}<{@link Boxroom}>
     */
    public List<Boxroom> selectBoxroomListByBoxroomIdList(@Param("boxroomIdList") List<Long> boxroomIdList);

    /**
     * 添加文件
     *
     * @param boxroomId 收藏夹id
     * @param fileId    文件标识
     * @return int
     */
    public int addFile(@Param("boxroomId") Long boxroomId, @Param("fileId") Long fileId);

    /**
     * 删除文件
     *
     * @param boxroomId 收藏夹id
     * @param fileId    文件标识
     * @return int
     */
    public int deleteFile(@Param("boxroomId") Long boxroomId, @Param("fileId") Long fileId);

    /**
     * 检查收藏夹唯一
     *
     * @param userId      用户id
     * @param boxroomName 收藏夹名字
     * @return int
     */
    public boolean checkBoxroomUnique(@Param("userId") Long userId, @Param("boxroomName") String boxroomName);

    /**
     * 检查收藏夹和文件唯一
     *
     * @param boxroomId 收藏夹id
     * @param fileId    文件id
     * @return boolean
     */
    public boolean isBoxroomAndFileExist(@Param("boxroomId") Long boxroomId, @Param("fileId") Long fileId);

    /**
     * 获得用户id
     *
     * @param boxroomId 收藏夹id
     * @return {@link Long}
     */
    public Long getUserId(@Param("boxroomId") Long boxroomId);

    /**
     * 查询收藏夹id通过用户id和收藏夹名字
     *
     * @param userId      用户id
     * @param boxroomName 收藏夹名字
     * @return {@link Long}
     */
    public Long selectBoxroomIdByUserIdAndBoxroomName(@Param("userId") Long userId, @Param("boxroomName") String boxroomName);
}
